home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 001-025 / scopedisk6 / atoolsm2 / atooldef < prev    next >
Text File  |  1995-03-18  |  3KB  |  78 lines

  1. DEFINITION MODULE AudioTools; (* BASED ON AUDIOTOOLS RELEASE.3.0 by Rob Peck  *)
  2.                              (* adapted to M2Amiga Modula-2 by Anthony Bryant *)
  3. FROM SYSTEM IMPORT
  4.  ADDRESS, BYTE;
  5. FROM Audio IMPORT
  6.  hardChannels;
  7. FROM Exec IMPORT
  8.  Byte, IORequest, Message, MsgPortPtr;
  9.  
  10. CONST
  11.  maxChan = hardChannels;
  12.  audBuffers = 20;  (* number of iob msg packets before need to allot *)
  13.  audClock = 3579545; 
  14.                            (* error return messages *)
  15.  badChannelSelected = -1;  (* channel # out of range *)
  16.  notYourChannel     = -2;  (* not owned by your task *)
  17.  outOfMemory        = -3;  (* error return from AllocMem *)
  18.  
  19. TYPE
  20.  ExtIOB=RECORD
  21.   request:  IORequest;
  22.   allocKey: INTEGER;
  23.   data: ADDRESS;
  24.   length: LONGCARD;
  25.   period: CARDINAL;
  26.   volume: CARDINAL;
  27.   cycles: CARDINAL;
  28.   writeMsg: Message;    (* up to here, same as IOAudio *)
  29.   identifier: LONGINT;    (* This field is added *)
  30.  END;
  31.  ExtIOBPtr=POINTER TO ExtIOB;
  32.  
  33.  
  34. PROCEDURE InitAudio(): MsgPortPtr;
  35. PROCEDURE CheckIfDone(): BOOLEAN;
  36. PROCEDURE FinishAudio(uport: MsgPortPtr);
  37.  
  38. PROCEDURE GetChannel(channel: LONGINT): LONGINT;
  39. PROCEDURE FreeChannel(channel: LONGINT): LONGINT;
  40. PROCEDURE StopChannel(channel: LONGINT): LONGINT;
  41. PROCEDURE StartChannel(channel: LONGINT): LONGINT;
  42. PROCEDURE FlushChannel(channel: LONGINT): LONGINT;
  43. PROCEDURE ResetChannel(channel: LONGINT): LONGINT;
  44. PROCEDURE IsThatMyChan(channel: LONGINT): LONGINT;
  45.  
  46. PROCEDURE MayGetNote(uport: MsgPortPtr; flag: BOOLEAN): LONGINT;
  47.  
  48. PROCEDURE SetWave(channel: LONGINT;
  49.               VAR waveform: ARRAY OF BYTE): LONGINT;
  50. PROCEDURE SetSamp(channel: LONGINT;
  51.               VAR sampleaudio: ADDRESS;
  52.                   length: LONGINT): LONGINT;              
  53. PROCEDURE SetPV(channel: LONGINT;
  54.                 period, volume: CARDINAL): LONGINT;
  55. PROCEDURE PlayNote(channel: LONGINT;
  56.                    note:    CARDINAL;  (* specific note number 0-95 *)
  57.                    volume:   CARDINAL; (* volume 0-64 *)
  58.                    duration: CARDINAL; (* 1000ths of a second *)
  59.                    priority: Byte; (* precedence value -128 to 127 *)
  60.                    messageport: MsgPortPtr; (* for use by MayGetNote() *)
  61.                    id: LONGINT);
  62. PROCEDURE PlayFreq(channel: LONGINT;
  63.                    freq:   CARDINAL;   (* specific frequency 28Hz to 7000Hz *)
  64.                    volume:  CARDINAL;  (* volume 0-64 *)
  65.                    duration: CARDINAL; (* 1000ths of a second *)
  66.                    priority: Byte; (* precedence value -128 to 127 *)
  67.                    messageport: MsgPortPtr; (* for use by MayGetNote() *)
  68.                    id: LONGINT);
  69. PROCEDURE PlaySamp(channel: LONGINT;
  70.                    period:  CARDINAL;  (* specific period value 127 to 500 *)
  71.                    volume:  CARDINAL;  (* volume 0-64 *)
  72.                    duration: CARDINAL; (* 1000ths of a second *)
  73.                    priority: Byte; (* precedence value -128 to 127 *)
  74.                    messageport: MsgPortPtr; (* for use by MayGetNote() *)
  75.                    id: LONGINT);
  76.                    
  77. END AudioTools.def
  78.